<?php

use backend\assets\AgentAsset;
use yii\helpers\Html;
use yii\helpers\Url;

use common\models\SysMenu;

$menuList = isset($this->params['menuList']) ? $this->params['menuList'] : [];

AgentAsset::register($this);
?>
<?php $this->beginPage() ?>
<!DOCTYPE html>
<html lang="<?= Yii::$app->language ?>">
<head>
    <meta charset="<?= Yii::$app->charset ?>">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate" />
    <?= Html::csrfMetaTags() ?>
    <title>美粒儿店务管理系统</title>
    <?php $this->head() ?>
</head>
<body>
<?php $this->beginBody() ?>
	<div class="wrap">
<!--		<div class="wrap_top">
			<div class="z">
				<a href="#" class="logo"><img src="<?= Yii::getAlias('@web/i/logo.jpg') ?>" /></a>
				<span><?=$this->userinfo->user_name?><br />欢迎回来！</span>
			</div>
			<div class="y">
				<span>
					<a href="javascript:void(0);" class="min"></a>
					<a href="javascript:wrap_mid();" class="mid"></a>
					<a href="javascript:void(0);" class="close"></a>
				</span>
			</div>
		</div>-->

		<div class="navbar navbar-inverse navbar-static-top top-bar">
			<div class="container-fluid" style="padding-left: 30px">
				<div class="navbar-header">
					<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-collapse">
						<span class="sr-only" translate="">Toggle navigation</span>
						<span class="icon-bar icon-bar-1"></span>
						<span class="icon-bar icon-bar-2"></span>
						<span class="icon-bar icon-bar-3"></span>
					</button>
					<div class="user-menu clearfix">
						<img class="pull-left mr20" src="<?= Yii::getAlias('@web/backend/img/home/top-bar/touxiang.png') ?>" alt="meelier">
						<div class="user-menu-title pull-left">
							欢迎<br>
							<div class="name"><?=$this->userinfo->user_name?></div>
						</div>
					</div>
				</div>
				<div class="collapse navbar-collapse" id="navbar-collapse">
					<ul class="top-bar-left nav navbar-nav">

						<?php foreach($menuList as $menu): ?>
							<?php if ($menu['_child']) { ?>

								<li class="dropdown" style="position: relative;">
									<a href="<?= $menu['menu_url'] ? Url::to([$menu['menu_url']]) : 'javascript:;' ?>" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-delay="" data-close-others="false"><em><i><?= $menu['titile'] ?></i></em></a>
									<ul class="dropdown-menu">
										<?php foreach($menu['_child'] as $val): ?>
											<li><a tabindex="-1" href="<?= $val['menu_url'] ? Url::to([$val['menu_url']]) : 'javascript:;' ?>"><?= $val['titile'] ?></a></li>

										<?php endforeach; ?>
									</ul>
								</li>

							<?php } else { ?>

								<li><a href="<?= Url::to([$menu['menu_url']]) ?>"><em><i><?= $menu['titile'] ?></i></em></a></li>

							<?php } ?>
						<?php endforeach; ?>

					</ul>
					<ul class="top-bar-right nav navbar-nav navbar-right">
				<!--		<li><a href="">动效 on</a></li>-->

<!--						<?php if($this->userinfo->user_type == 3){?>
						    <li><a href="<?=Url::toRoute(['/business/shopmanage/list'])?>"><img src="<?= Yii::getAlias('@web/backend/img/home/top-bar/people.png') ?>" alt=""/></a></li>
						<?php }?>
						<li><a href="<?=Url::toRoute(['/business/config/list','type'=>1])?>"><img src="<?= Yii::getAlias('@web/backend/img/home/top-bar/shezhi.png') ?>" alt="设置"/></a></li>
						<li><a href="<?=Url::toRoute('/base/logout')?>"><img src="<?= Yii::getAlias('@web/backend/img/home/top-bar/exit.png') ?>" alt="退出登录"/></a></li>
						<li class="user-menu">
							<a href="" class="dropdown-toggle" data-toggle="dropdown">
								<img class="user-image" src="<?= Yii::getAlias('@web/backend/img/home/top-bar/touxiang.png') ?>" alt="头像"/>
								<div style="float: left;margin-top: -10px;">
									欢迎
									<div><?=$this->userinfo->user_name?></div>
								</div>
							</a>
						</li>-->

						<li class="imgBg"><img src="<?= Yii::getAlias('@web/backend/img/home/top-bar/logo.png') ?>" alt="meelier"></li>
						<li class="dropdown subNav">
							<a class="dropdown-toggle moreIcon" data-toggle="dropdown" href=""><img src="<?= Yii::getAlias('@web/backend/img/home/top-bar/moreicon.png') ?>" alt=""/></a>
							<ul class="dropdown-menu">
								<?php if($this->userinfo->user_type == 3){?>
								<li><a href="<?=Url::toRoute(['/business/shopmanage/list'])?>"><img class="imgIcon list" src="<?= Yii::getAlias('@web/backend/img/home/top-bar/profile1.png') ?>" alt=""/>账号列表</a></li>
								<?php }?>

								<li><a href="<?=Url::toRoute('/base/logout')?>"><img class="imgIcon logout" src="<?= Yii::getAlias('@web/backend/img/home/top-bar/closeexcit.png') ?>" alt=""/>退出</a></li>

							</ul>
						</li>
					</ul>
				</div>

			</div>

		</div>
		
		
		<div class="wrap_main">
			<div class="wrap_right">
				<?=$content ?>
			</div>
		</div>
	</div>

<?php $this->beginBlock('js_index_end') ?>
$('.top-bar-left>li').hover(function(){
$(this).find('i').addClass('animated flipInX');
},function(){
$(this).find('i').removeClass('animated flipInX');
});

		/*窗口放大放小*/
		function wrap_mid(){
			$('.mid').toggleClass('mids');
		}
		/*框架大小调整*/
		function body_height(){
			var bodyheight=document.body.clientHeight,
				height=bodyheight-80,
				bodywidth=document.body.clientWidth,
				right_width=bodywidth-201;
	
			$('.wrap_main').height(height);
<!--			$('.wrap_right').width(right_width);-->
		}
		$(window).resize(function(){
			body_height();
		});
		$(function(){
			body_height();
			//$("#myform").Validform();
		})
		
		/*left顶部增加菜单效果*/
		$('.left_top .m').hover(function(){
			$(this).toggleClass('m_on');
			$(this).find('ul').toggle();
		})
		
		/*left导航背景伪类*/
		$('.left_nav li a').hover(function(){
			var bg_pic='i/'+$(this).attr('bg_pic')+'s.jpg';
			$(this).css('background-image','url('+bg_pic+')');
		},function(){
			if(!$(this).hasClass('on')){
				var bg_pic='i/'+$(this).attr('bg_pic')+'.jpg';
				$(this).css('background-image','url('+bg_pic+')');
			}
		})
		
		/*left导航整体效果*/
		var left_nav_a=$('.left_nav li a'),prev_a=0;
		left_nav_a.click(function(){
			
			var bg_pic='i/'+left_nav_a.eq(prev_a).attr('bg_pic')+'.jpg';
			left_nav_a.eq(prev_a).css('background-image','url('+bg_pic+')');
			
			prev_a=left_nav_a.index(this);
			left_nav_a.removeClass('on').filter($(this)).addClass('on');
			var bg_pic='i/'+$(this).attr('bg_pic')+'s.jpg';
			$(this).css('background-image','url('+bg_pic+')');
		
			$(this).next('ul').slideToggle(100);
			var _url=$(this).attr('href');
			
			$(this).parent().siblings().find('ul').slideUp(100);
			window.parent.main.location.href=_url;
			return false;
		})
		

<?php $this->endBlock() ?>
<?php $this->registerJs($this->blocks['js_index_end'], $this::POS_END); ?>

<?php $this->endBody() ?>



</body>
</html>
<?php $this->endPage() ?>
